// pages/SocialSecurityCard/SocialSecurity_all/SocialSecurity_all.js
import {
  queryTempFunctionCode
} from '../../../utils/login'
import {saveMatter} from '../../../utils/my'
Page({

  /**
   * 页面的初始数据
   */
  data: {
    menuInfo: {},
    str:[
      {id:'1',name:'劳动保障监察举报登记',code:"LDGX_0001",icon:'ldgx1'},
      {id:'2',name:'劳动保障监察举报调查',code:"LDGX_0001",icon:'ldgx2'},
      {id:'3',name:'劳动保障监察举报处理',code:"LDGX_0001",icon:'ldgx3'},
      {id:'4',name:'劳动保障监察投诉登记',code:"LDGX_0003",icon:'ldgx4'},
      {id:'5',name:'劳动保障监察投诉调查',code:"LDGX_0003",icon:'ldgx5'},
      {id:'6',name:'劳动保障监察投诉处理',code:"LDGX_0003",icon:'ldgx6'},
      {id:'7',name:'劳动人事争议调解申请',code:"LDGX_0004",icon:'ldgx7'},
    ]
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {

  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {
    //设置头部字体与导航栏对齐
    const top= getApp()
    this.setData({
      menuInfo:top.geibartop.menuInfo
    })
  },
  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {

  },
  //跳转页面
  jumpPage(e) {
    const code = e.currentTarget.dataset.code;
    const name = e.currentTarget.dataset.name;
    if(code){
      queryTempFunctionCode(code).then(res => {
        saveMatter(name) //保存事项
        wx.navigateTo({
          url: '/pages/web_h5/web_h5?url=' + encodeURIComponent(res.data)
        })
      })
    }else{
      wx.showToast({
        title: '功能代码错误！',
        icon: 'error',
        duration: 2000
      })
    }
  },
  //返回上一级
  backPage(){
    wx.navigateBack({
      delta: 1
    });    
  },
})